<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   深度学习与自然语言处理(1)_斯坦福cs224d Lecture 1  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/24467.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466454442: Accept with keywords: (title(0.5):社区,自然语言处理,数盟,深度学习, topn(0.433333333333):概率,概率分布,自然语言处理,数盟,深度学习,行业资讯,产生,模型,词袋,例子,参数,文章,方法,单词表,向量,抽样,函数,词语,语料库,矩阵,关联,目标,词组,损失,句子,单词,课程,中心词,维度,负面).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    深度学习与自然语言处理(1)_斯坦福cs224d Lecture 1
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    深度学习与自然语言处理(1)_斯坦福cs224d Lecture 1 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,81] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/industry">
       行业
      </a>
      &gt;
      <a href="http://dataunion.org/category/industry/news">
       行业资讯
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/24467.html">
          深度学习与自然语言处理(1)_斯坦福cs224d Lecture 1
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          1,281 次阅读 -
         </em>
         <a href="http://dataunion.org/category/industry/news" rel="category tag">
          行业资讯
         </a>
         ,
         <a href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" rel="category tag">
          深度学习
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        <img src="http://dataunion.org/wp-content/uploads/2014/11/weixin1.jpg"/>
       </p>
       <p style="text-align: center;">
        关注数盟君 每天定时收取好文章推送
       </p>
       <p>
        作者：
        <a href="http://blog.csdn.net/han_xiaoyang">
         寒小阳
        </a>
        &amp;&amp;
        <a href="http://blog.csdn.net/longxinchen_ml">
         龙心尘
        </a>
       </p>
       <p>
        原文链接：http://blog.csdn.net/longxinchen_ml/article/details/51567960
        <br/>
        时间：2016年6月
        <br/>
        出处：
        <br/>
        <a href="http://blog.csdn.net/han_xiaoyang/article/details/51567822">
         http://blog.csdn.net/han_xiaoyang/article/details/51567822
        </a>
        <br/>
        <a href="http://blog.csdn.net/longxinchen_ml/article/details/51567960">
         http://blog.csdn.net/longxinchen_ml/article/details/51567960
        </a>
        <br/>
        声明：版权所有，转载请联系作者并注明出处
       </p>
       <p>
        说明：本文为斯坦福大学CS224d课程的中文版内容笔记，已得到斯坦福大学课程@Richard Socher教授的授权翻译与发表
       </p>
       <p>
        特别鸣谢：@Fantzy同学对部分内容翻译的帮助
        <br/>
        课堂笔记：第一部分
       </p>
       <p>
        春季2016
       </p>
       <p>
        关键词：自然语言处理（NLP）.词向量（Word Vectors）.奇异值分解(Singular Value Decomposition). Skip-gram. 词组的持续爆（CBOW）,负采样样本（Negative Sampling）
       </p>
       <p>
        这是本课程的第一节，我们会先介绍自然语言处理（NLP）的概念和NLP现在所面对问题；然后开始讨论用数学向量代表自然语言词组的设想。最后我们会讨论现行的词向量构造方法。
       </p>
       <h3 id="1-自然语言处理简介">
        <p name="t0">
        </p>
        1. 自然语言处理简介
       </h3>
       <p>
        在最开始咱们先说说什么是NLP。NLP的目的是设计出算法，让计算机“懂得”人类的自然语言，从而为人类执行任务。这些任务分为几个难度等级，例如
       </p>
       <p>
        <strong>
         容易的任务
        </strong>
        ：
       </p>
       <ul>
        <li>
         语法检查
        </li>
        <li>
         关键词搜索
        </li>
        <li>
         查找同义词
        </li>
       </ul>
       <p>
        <strong>
         中等难度的任务
        </strong>
        ：
       </p>
       <ul>
        <li>
         从网站，文件或其他来源中提取信息
        </li>
       </ul>
       <p>
        <strong>
         比较有挑战的任务
        </strong>
        ：
       </p>
       <ul>
        <li>
         机器翻译（例如：中译英）
        </li>
        <li>
         语意分析（提问者说的意思是什么）
        </li>
        <li>
         指代分析（例如. “他”或“它”在一个特定文件中指的是什么）
        </li>
        <li>
         回答问题（例如.回答“Jeopardy Questions”一种涉及人类社会各个方面的综艺问答）
        </li>
       </ul>
       <p>
        在处理所有NLP任务的时候，我们首先需要解决非常重要的一个问题(可能是最重要的)：用什么方式将词组输入到模型中去。简单的NLP问题可能并不需要将词组作为独立个体对待（atomic symbols），但现在的问题绝大多数需要这样一个预处理，来体现词组之间关联/相似性和区别。所以我们引入词向量的概念，如果把词编码成词向量，我们很容易从向量的角度去衡量不同的词之间的关联与差异（常用的距离测度法，包括Jaccard, Cosine, Euclidean等等，注：距离测度法，即用一个可观测度量的量来描述一个不能直接观测度量的量）。
       </p>
       <h3 id="2词向量">
        <p name="t1">
        </p>
        2.词向量
       </h3>
       <p>
        我们拿英文举例。
       </p>
       <p>
        英语中大约有1300万个词组（token，自定义字符串，译作词组），不过他们全部是独立的吗？并不是哦，比如有一些词组，“Feline猫科动物”和“Cat猫”，“Hotel宾馆“和”Motel汽车旅馆”，其实有一定的关联或者相似性在。因此，我们希望用词向量编码词组，使它代表在词组的N维空间中的一个点（而点与点之间有距离的远近等关系，可以体现深层一点的信息）。每一个词向量的维度都可能会表征一些意义（物理含义），这些意义我们用“声明speech”来定义。例如，语义维度可以用来表明时态（过去与现在与未来），计数（单数与复数），和性别（男性与女性）。
       </p>
       <p>
        说起来，词向量的编码方式其实挺有讲究的。咱们从最简单的看起，最简单的编码方式叫做one-hot vector：假设我们的词库总共有n个词，那我们开一个1*n的高维向量，而每个词都会在某个索引index下取到1，其余位置全部都取值为0.词向量在这种类型的编码中如下图所示：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-1-Frame">
         <span class="math" id="MathJax-Span-1">
          <span class="mrow" id="MathJax-Span-2">
           <span class="msubsup" id="MathJax-Span-3">
            <span class="mi" id="MathJax-Span-4">
             w
            </span>
            <span class="texatom" id="MathJax-Span-5">
             <span class="mrow" id="MathJax-Span-6">
              <span class="mi" id="MathJax-Span-7">
               a
              </span>
              <span class="mi" id="MathJax-Span-8">
               a
              </span>
              <span class="mi" id="MathJax-Span-9">
               r
              </span>
              <span class="mi" id="MathJax-Span-10">
               d
              </span>
              <span class="mi" id="MathJax-Span-11">
               c
              </span>
              <span class="mi" id="MathJax-Span-12">
               a
              </span>
              <span class="mi" id="MathJax-Span-13">
               r
              </span>
              <span class="mi" id="MathJax-Span-14">
               k
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-15">
            =
           </span>
           <span class="mrow" id="MathJax-Span-16">
            <span class="mo" id="MathJax-Span-17">
             ⎡⎣⎢⎢⎢⎢⎢⎢⎢
            </span>
            <span class="mtable" id="MathJax-Span-18">
             <span class="mtd" id="MathJax-Span-19">
              <span class="mrow" id="MathJax-Span-20">
               <span class="mn" id="MathJax-Span-21">
                1
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-22">
              <span class="mrow" id="MathJax-Span-23">
               <span class="mn" id="MathJax-Span-24">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-25">
              <span class="mrow" id="MathJax-Span-26">
               <span class="mn" id="MathJax-Span-27">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-28">
              <span class="mrow" id="MathJax-Span-29">
               <span class="mo" id="MathJax-Span-30">
                ⋮
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-31">
              <span class="mrow" id="MathJax-Span-32">
               <span class="mn" id="MathJax-Span-33">
                0
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-34">
             ⎤⎦⎥⎥⎥⎥⎥⎥⎥
            </span>
           </span>
           <span class="mo" id="MathJax-Span-35">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-36">
            <span class="mi" id="MathJax-Span-37">
             w
            </span>
            <span class="texatom" id="MathJax-Span-38">
             <span class="mrow" id="MathJax-Span-39">
              <span class="mi" id="MathJax-Span-40">
               a
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-41">
            =
           </span>
           <span class="mrow" id="MathJax-Span-42">
            <span class="mo" id="MathJax-Span-43">
             ⎡⎣⎢⎢⎢⎢⎢⎢⎢
            </span>
            <span class="mtable" id="MathJax-Span-44">
             <span class="mtd" id="MathJax-Span-45">
              <span class="mrow" id="MathJax-Span-46">
               <span class="mn" id="MathJax-Span-47">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-48">
              <span class="mrow" id="MathJax-Span-49">
               <span class="mn" id="MathJax-Span-50">
                1
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-51">
              <span class="mrow" id="MathJax-Span-52">
               <span class="mn" id="MathJax-Span-53">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-54">
              <span class="mrow" id="MathJax-Span-55">
               <span class="mo" id="MathJax-Span-56">
                ⋮
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-57">
              <span class="mrow" id="MathJax-Span-58">
               <span class="mn" id="MathJax-Span-59">
                0
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-60">
             ⎤⎦⎥⎥⎥⎥⎥⎥⎥
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-61">
            <span class="mi" id="MathJax-Span-62">
             w
            </span>
            <span class="texatom" id="MathJax-Span-63">
             <span class="mrow" id="MathJax-Span-64">
              <span class="mi" id="MathJax-Span-65">
               a
              </span>
              <span class="mi" id="MathJax-Span-66">
               t
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-67">
            =
           </span>
           <span class="mrow" id="MathJax-Span-68">
            <span class="mo" id="MathJax-Span-69">
             ⎡⎣⎢⎢⎢⎢⎢⎢⎢
            </span>
            <span class="mtable" id="MathJax-Span-70">
             <span class="mtd" id="MathJax-Span-71">
              <span class="mrow" id="MathJax-Span-72">
               <span class="mn" id="MathJax-Span-73">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-74">
              <span class="mrow" id="MathJax-Span-75">
               <span class="mn" id="MathJax-Span-76">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-77">
              <span class="mrow" id="MathJax-Span-78">
               <span class="mn" id="MathJax-Span-79">
                1
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-80">
              <span class="mrow" id="MathJax-Span-81">
               <span class="mo" id="MathJax-Span-82">
                ⋮
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-83">
              <span class="mrow" id="MathJax-Span-84">
               <span class="mn" id="MathJax-Span-85">
                0
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-86">
             ⎤⎦⎥⎥⎥⎥⎥⎥⎥
            </span>
           </span>
           <span class="mo" id="MathJax-Span-87">
            ⋯
           </span>
           <span class="mspace" id="MathJax-Span-88">
           </span>
           <span class="msubsup" id="MathJax-Span-89">
            <span class="mi" id="MathJax-Span-90">
             w
            </span>
            <span class="texatom" id="MathJax-Span-91">
             <span class="mrow" id="MathJax-Span-92">
              <span class="mi" id="MathJax-Span-93">
               z
              </span>
              <span class="mi" id="MathJax-Span-94">
               e
              </span>
              <span class="mi" id="MathJax-Span-95">
               b
              </span>
              <span class="mi" id="MathJax-Span-96">
               r
              </span>
              <span class="mi" id="MathJax-Span-97">
               a
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-98">
            =
           </span>
           <span class="mrow" id="MathJax-Span-99">
            <span class="mo" id="MathJax-Span-100">
             ⎡⎣⎢⎢⎢⎢⎢⎢⎢
            </span>
            <span class="mtable" id="MathJax-Span-101">
             <span class="mtd" id="MathJax-Span-102">
              <span class="mrow" id="MathJax-Span-103">
               <span class="mn" id="MathJax-Span-104">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-105">
              <span class="mrow" id="MathJax-Span-106">
               <span class="mn" id="MathJax-Span-107">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-108">
              <span class="mrow" id="MathJax-Span-109">
               <span class="mn" id="MathJax-Span-110">
                0
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-111">
              <span class="mrow" id="MathJax-Span-112">
               <span class="mo" id="MathJax-Span-113">
                ⋮
               </span>
              </span>
             </span>
             <span class="mtd" id="MathJax-Span-114">
              <span class="mrow" id="MathJax-Span-115">
               <span class="mn" id="MathJax-Span-116">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-117">
             ⎤⎦⎥⎥⎥⎥⎥⎥⎥
            </span>
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        这种词向量编码方式简单粗暴，我们将每一个词作为一个完全独立的个体来表达。遗憾的是，这种方式下，我们的词向量没办法给我们任何形式的词组相似性权衡。例如:
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-2-Frame">
         <span class="math" id="MathJax-Span-118">
          <span class="mrow" id="MathJax-Span-119">
           <span class="mo" id="MathJax-Span-120">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-121">
            <span class="mi" id="MathJax-Span-122">
             w
            </span>
            <span class="texatom" id="MathJax-Span-123">
             <span class="mrow" id="MathJax-Span-124">
              <span class="mi" id="MathJax-Span-125">
               h
              </span>
              <span class="mi" id="MathJax-Span-126">
               o
              </span>
              <span class="mi" id="MathJax-Span-127">
               t
              </span>
              <span class="mi" id="MathJax-Span-128">
               e
              </span>
              <span class="mi" id="MathJax-Span-129">
               l
              </span>
             </span>
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-130">
            <span class="mo" id="MathJax-Span-131">
             )
            </span>
            <span class="mi" id="MathJax-Span-132">
             T
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-133">
            <span class="mi" id="MathJax-Span-134">
             w
            </span>
            <span class="texatom" id="MathJax-Span-135">
             <span class="mrow" id="MathJax-Span-136">
              <span class="mi" id="MathJax-Span-137">
               m
              </span>
              <span class="mi" id="MathJax-Span-138">
               o
              </span>
              <span class="mi" id="MathJax-Span-139">
               t
              </span>
              <span class="mi" id="MathJax-Span-140">
               e
              </span>
              <span class="mi" id="MathJax-Span-141">
               l
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-142">
            =
           </span>
           <span class="mo" id="MathJax-Span-143">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-144">
            <span class="mi" id="MathJax-Span-145">
             w
            </span>
            <span class="texatom" id="MathJax-Span-146">
             <span class="mrow" id="MathJax-Span-147">
              <span class="mi" id="MathJax-Span-148">
               h
              </span>
              <span class="mi" id="MathJax-Span-149">
               o
              </span>
              <span class="mi" id="MathJax-Span-150">
               t
              </span>
              <span class="mi" id="MathJax-Span-151">
               e
              </span>
              <span class="mi" id="MathJax-Span-152">
               l
              </span>
             </span>
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-153">
            <span class="mo" id="MathJax-Span-154">
             )
            </span>
            <span class="mi" id="MathJax-Span-155">
             T
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-156">
            <span class="mi" id="MathJax-Span-157">
             w
            </span>
            <span class="texatom" id="MathJax-Span-158">
             <span class="mrow" id="MathJax-Span-159">
              <span class="mi" id="MathJax-Span-160">
               c
              </span>
              <span class="mi" id="MathJax-Span-161">
               a
              </span>
              <span class="mi" id="MathJax-Span-162">
               t
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-163">
            =
           </span>
           <span class="mn" id="MathJax-Span-164">
            0
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        （注：这里
        <span class="MathJax" id="MathJax-Element-3-Frame">
         <span class="math" id="MathJax-Span-165">
          <span class="mrow" id="MathJax-Span-166">
           <span class="msubsup" id="MathJax-Span-167">
            <span class="mi" id="MathJax-Span-168">
             W
            </span>
            <span class="texatom" id="MathJax-Span-169">
             <span class="mrow" id="MathJax-Span-170">
              <span class="mo" id="MathJax-Span-171">
               −
              </span>
              <span class="mn" id="MathJax-Span-172">
               1
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
        是
        <span class="MathJax" id="MathJax-Element-4-Frame">
         <span class="math" id="MathJax-Span-173">
          <span class="mrow" id="MathJax-Span-174">
           <span class="mi" id="MathJax-Span-175">
            W
           </span>
          </span>
         </span>
        </span>
        的逆矩阵，它们有关系：
        <span class="MathJax" id="MathJax-Element-5-Frame">
         <span class="math" id="MathJax-Span-176">
          <span class="mrow" id="MathJax-Span-177">
           <span class="msubsup" id="MathJax-Span-178">
            <span class="mi" id="MathJax-Span-179">
             W
            </span>
            <span class="texatom" id="MathJax-Span-180">
             <span class="mrow" id="MathJax-Span-181">
              <span class="mo" id="MathJax-Span-182">
               −
              </span>
              <span class="mn" id="MathJax-Span-183">
               1
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-184">
            ∗
           </span>
           <span class="mi" id="MathJax-Span-185">
            W
           </span>
           <span class="mo" id="MathJax-Span-186">
            =
           </span>
           <span class="mn" id="MathJax-Span-187">
            1
           </span>
          </span>
         </span>
        </span>
        ，注意到hotel和motel是近义词）
       </p>
       <p>
        究其根本你会发现，是你开了一个极高维度的空间，然后每个词语都会占据一个维度，因此没有办法在空间中关联起来。因此我们可能可以把词向量的维度降低一些，在这样一个子空间中，可能原本没有关联的词就关联起来了。
       </p>
       <h3 id="3基于svd的方法">
        <p name="t2">
        </p>
        3.基于SVD的方法
       </h3>
       <p>
        这是一种构造词嵌入（即词向量）的方法，我们首先会遍历所有的文本数据集，然后统计词出现的次数，接着用一个矩阵
        <span class="MathJax" id="MathJax-Element-6-Frame">
         <span class="math" id="MathJax-Span-188">
          <span class="mrow" id="MathJax-Span-189">
           <span class="mi" id="MathJax-Span-190">
            X
           </span>
          </span>
         </span>
        </span>
        来表示所有的次数情况，紧接着对X进行奇异值分解得到一个
        <span class="MathJax" id="MathJax-Element-7-Frame">
         <span class="math" id="MathJax-Span-191">
          <span class="mrow" id="MathJax-Span-192">
           <span class="mi" id="MathJax-Span-193">
            U
           </span>
           <span class="mi" id="MathJax-Span-194">
            S
           </span>
           <span class="msubsup" id="MathJax-Span-195">
            <span class="mi" id="MathJax-Span-196">
             V
            </span>
            <span class="mi" id="MathJax-Span-197">
             T
            </span>
           </span>
          </span>
         </span>
        </span>
        的分解。然后用
        <span class="MathJax" id="MathJax-Element-8-Frame">
         <span class="math" id="MathJax-Span-198">
          <span class="mrow" id="MathJax-Span-199">
           <span class="mi" id="MathJax-Span-200">
            U
           </span>
          </span>
         </span>
        </span>
        的行（rows）作为所有词表中词的词向量。对于矩阵
        <span class="MathJax" id="MathJax-Element-9-Frame">
         <span class="math" id="MathJax-Span-201">
          <span class="mrow" id="MathJax-Span-202">
           <span class="mi" id="MathJax-Span-203">
            X
           </span>
          </span>
         </span>
        </span>
        ，我们有几种选择，咱们一起来比较一下。
       </p>
       <h4 id="31-词-文档矩阵">
        <p name="t3">
        </p>
        3.1 词-文档矩阵
       </h4>
       <p>
        最初的想法是，我们猜测相互关联的词组同时出现在相同的文件中的概率很高。例如，“银行”、“债券”、“股票”、“钱”等都可能出现在一起。但是，“银行”、“章鱼”、“香蕉”和“曲棍球”可能不会一直一起出现。基于这个想法，我们建立一个词组文档矩阵
        <span class="MathJax" id="MathJax-Element-10-Frame">
         <span class="math" id="MathJax-Span-204">
          <span class="mrow" id="MathJax-Span-205">
           <span class="mi" id="MathJax-Span-206">
            X
           </span>
          </span>
         </span>
        </span>
        ，具体是这么做的：遍历海量的文件，每次词组i出现在文件j中时，将
        <span class="MathJax" id="MathJax-Element-11-Frame">
         <span class="math" id="MathJax-Span-207">
          <span class="mrow" id="MathJax-Span-208">
           <span class="msubsup" id="MathJax-Span-209">
            <span class="mi" id="MathJax-Span-210">
             X
            </span>
            <span class="texatom" id="MathJax-Span-211">
             <span class="mrow" id="MathJax-Span-212">
              <span class="mi" id="MathJax-Span-213">
               i
              </span>
              <span class="mi" id="MathJax-Span-214">
               j
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
        的值加1。不过大家可想而知，这会是个很大的矩阵
        <span class="MathJax" id="MathJax-Element-12-Frame">
         <span class="math" id="MathJax-Span-215">
          <span class="mrow" id="MathJax-Span-216">
           <span class="msubsup" id="MathJax-Span-217">
            <span class="mi" id="MathJax-Span-218">
             R
            </span>
            <span class="texatom" id="MathJax-Span-219">
             <span class="mrow" id="MathJax-Span-220">
              <span class="texatom" id="MathJax-Span-221">
               <span class="mrow" id="MathJax-Span-222">
                <span class="mo" id="MathJax-Span-223">
                 |
                </span>
               </span>
              </span>
              <span class="mi" id="MathJax-Span-224">
               V
              </span>
              <span class="texatom" id="MathJax-Span-225">
               <span class="mrow" id="MathJax-Span-226">
                <span class="mo" id="MathJax-Span-227">
                 |
                </span>
               </span>
              </span>
              <span class="mo" id="MathJax-Span-228">
               ×
              </span>
              <span class="mi" id="MathJax-Span-229">
               M
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
        ，而且矩阵大小还和文档个数M有关系。所以咱们最好想办法处理和优化一下。
       </p>
       <h4 id="32-基于窗口的共现矩阵x">
        <p name="t4">
        </p>
        3.2 基于窗口的共现矩阵X
       </h4>
       <p>
        我们还是用一样的逻辑，不过换一种统计方式，把矩阵
        <span class="MathJax" id="MathJax-Element-13-Frame">
         <span class="math" id="MathJax-Span-230">
          <span class="mrow" id="MathJax-Span-231">
           <span class="mi" id="MathJax-Span-232">
            X
           </span>
          </span>
         </span>
        </span>
        记录的词频变成一个相关性矩阵。我们先规定一个固定大小的窗口，然后统计每个词出现在窗口中次数，这个计数是针对整个语料集做的。可能说得有点含糊，咱们一起来看个例子，假定我们有如下的3个句子，同时我们的窗口大小设定为1（把原始的句子分拆成一个一个的词）：
        <br/>
        1. I enjoy flying.
        <br/>
        2. I like NLP.
        <br/>
        3. I like deep learning.
        <br/>
        由此产生的计数矩阵如下：
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_1.png?imageView/2/w/450/q/100"/>
       </center>
       然后我们对X做奇异值分解，观察观察奇异值（矩阵的对角元素），并根据我们期待保留的百分比来进行阶段（只保留前k个维度）：
       <p>
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_2.png?imageView/2/w/150/q/100"/>
       </center>
       然后我们把子矩阵
       <span class="MathJax" id="MathJax-Element-14-Frame">
        <span class="math" id="MathJax-Span-233">
         <span class="mrow" id="MathJax-Span-234">
          <span class="msubsup" id="MathJax-Span-235">
           <span class="mi" id="MathJax-Span-236">
            U
           </span>
           <span class="texatom" id="MathJax-Span-237">
            <span class="mrow" id="MathJax-Span-238">
             <span class="mn" id="MathJax-Span-239">
              1
             </span>
             <span class="mo" id="MathJax-Span-240">
              :
             </span>
             <span class="texatom" id="MathJax-Span-241">
              <span class="mrow" id="MathJax-Span-242">
               <span class="mo" id="MathJax-Span-243">
                |
               </span>
              </span>
             </span>
             <span class="mi" id="MathJax-Span-244">
              V
             </span>
             <span class="texatom" id="MathJax-Span-245">
              <span class="mrow" id="MathJax-Span-246">
               <span class="mo" id="MathJax-Span-247">
                |
               </span>
              </span>
             </span>
             <span class="mo" id="MathJax-Span-248">
              ,
             </span>
             <span class="mn" id="MathJax-Span-249">
              1
             </span>
             <span class="mo" id="MathJax-Span-250">
              :
             </span>
             <span class="mi" id="MathJax-Span-251">
              k
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
       </span>
       视作我们的词嵌入矩阵。也就是说，对于词表中的每一个词，我们都用一个k维的向量来表达了。
       <p>
       </p>
       <p>
        对X采用奇异值分解
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_3.png"/>
       </center>
       通过选择前K个奇异向量来进行降维：
       <p>
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_4.png"/>
       </center>
       这两种方法都能产生词向量，它们能够充分地编码语义和句法的信息，但同时也带来了其他的问题：
       <p>
       </p>
       <ul>
        <li>
         矩阵的维度会经常变化（新的词语经常会增加，语料库的大小也会随时变化）。
        </li>
        <li>
         矩阵是非常稀疏的，因为大多数词并不同时出现。
        </li>
        <li>
         矩阵的维度通常非常高（
         <span class="MathJax" id="MathJax-Element-15-Frame">
          <span class="math" id="MathJax-Span-252">
           <span class="mrow" id="MathJax-Span-253">
            <span class="mo" id="MathJax-Span-254">
             ≈
            </span>
            <span class="msubsup" id="MathJax-Span-255">
             <span class="mn" id="MathJax-Span-256">
              10
             </span>
             <span class="mn" id="MathJax-Span-257">
              6
             </span>
            </span>
            <span class="mo" id="MathJax-Span-258">
             ×
            </span>
            <span class="msubsup" id="MathJax-Span-259">
             <span class="mn" id="MathJax-Span-260">
              10
             </span>
             <span class="mn" id="MathJax-Span-261">
              6
             </span>
            </span>
           </span>
          </span>
         </span>
         ）
        </li>
        <li>
         训练需要
         <span class="MathJax" id="MathJax-Element-16-Frame">
          <span class="math" id="MathJax-Span-262">
           <span class="mrow" id="MathJax-Span-263">
            <span class="mi" id="MathJax-Span-264">
             O
            </span>
            <span class="mo" id="MathJax-Span-265">
             (
            </span>
            <span class="msubsup" id="MathJax-Span-266">
             <span class="mi" id="MathJax-Span-267">
              n
             </span>
             <span class="mn" id="MathJax-Span-268">
              2
             </span>
            </span>
            <span class="mo" id="MathJax-Span-269">
             )
            </span>
           </span>
          </span>
         </span>
         的复杂度（比如SVD）
        </li>
        <li>
         需要专门对矩阵X进行特殊处理，以应对词组频率的极度不平衡的状况
        </li>
       </ul>
       <p>
        当然，有一些办法可以缓解一下上述提到的问题：
       </p>
       <ul>
        <li>
         忽视诸如“he”、“the” 、“has”等功能词。
        </li>
        <li>
         应用“倾斜窗口”（ramp window），即:根据文件中词组之间的距离给它们的共现次数增加相应的权重。
        </li>
        <li>
         使用皮尔森的相关性（Pearson correlation），将0记为负数，而不是它原来的数值。
        </li>
       </ul>
       <p>
        不过缓解终归只是缓解，咱们需要更合理地解决这些问题，这也就是我们马上要提到的基于迭代的方法。
       </p>
       <h3 id="4基于迭代的方法">
        <p name="t5">
        </p>
        4.基于迭代的方法
       </h3>
       <p>
        现在我们退后一步，来尝试一种新的方法。在这里我们并不计算和存储全局信息，因为这会包含太多大型数据集和数十亿句子。我们尝试创建一个模型，它能够一步步迭代地进行学习，并最终得出每个单词基于其上下文的条件概率。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768519bcfa56590366486" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          词语的上下文：
一个词语的上下文是它周围C个词以内的词。如果C=&lt;span class="hljs-number"&gt;2&lt;/span&gt;，句子&lt;span class="hljs-string"&gt;"The quick brown fox jumped over the lazy dog"&lt;/span&gt;中单词&lt;span class="hljs-string"&gt;"fox"&lt;/span&gt;的上下文为 {&lt;span class="hljs-string"&gt;"quick"&lt;/span&gt;, &lt;span class="hljs-string"&gt;"brown"&lt;/span&gt;, &lt;span class="hljs-string"&gt;"jumped"&lt;/span&gt;, &lt;span class="hljs-string"&gt;"over"&lt;/span&gt;}.
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768519bcfa56590366486-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768519bcfa56590366486-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768519bcfa56590366486-1">
               词语的上下文：
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768519bcfa56590366486-2">
               一个词语的上下文是它周围
               <span class="crayon-i">
                C
               </span>
               个词以内的词。如果
               <span class="crayon-v">
                C
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               ，句子
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "The quick brown fox jumped over the lazy dog"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               中单词
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "fox"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               的上下文为
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "quick"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "brown"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "jumped"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-string"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-s">
                "over"
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0265 seconds] -->
       <p>
       </p>
       <ul class="pre-numbering">
        <li>
         1
        </li>
        <li>
         2
        </li>
       </ul>
       <ul class="pre-numbering">
        <li>
         1
        </li>
        <li>
         2
        </li>
       </ul>
       <p>
        我们想建立一个概率模型，它包含已知和未知参数。每增加一个训练样本，它就能从模型的输入、输出和期望输出（标签），多学到一点点未知参数的信息。
       </p>
       <p>
        在每次迭代过程中，这个模型都能够评估其误差，并按照一定的更新规则，惩罚那些导致误差的参数。这种想法可以追溯到1986年（Learning representations by back-propagating errors. David E. Rumelhart, Geoffrey E. Hinton, and Ronald J.Williams (1988)），我们称之为误差“反向传播”法。
       </p>
       <h4 id="41-语言模型1-gram2-gram等等">
        <p name="t6">
        </p>
        4.1 语言模型（1-gram,2-gram等等）
       </h4>
       <p>
        首先，我们需要建立一个能给“分词序列”分配概率的模型。我们从一个例子开始：
       </p>
       <p>
        <code>
         "The cat jumped over the puddle."（猫 跳 过 水坑）
        </code>
       </p>
       <p>
        一个好的语言模型会给这句话以很高的概率，因为这是一个在语法和语义上完全有效的句子。同样地，这句”stock boil fish is toy”（股票 煮 鱼 是 玩具）就应该有一个非常低的概率 ，因为它是没有任何意义的。在数学上，我们可以令任意给定的n个有序的分词序列的概率为：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-17-Frame">
         <span class="math" id="MathJax-Span-270">
          <span class="mrow" id="MathJax-Span-271">
           <span class="mi" id="MathJax-Span-272">
            P
           </span>
           <span class="mo" id="MathJax-Span-273">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-274">
            <span class="mi" id="MathJax-Span-275">
             w
            </span>
            <span class="mn" id="MathJax-Span-276">
             1
            </span>
           </span>
           <span class="mo" id="MathJax-Span-277">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-278">
            <span class="mi" id="MathJax-Span-279">
             w
            </span>
            <span class="mn" id="MathJax-Span-280">
             2
            </span>
           </span>
           <span class="mo" id="MathJax-Span-281">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-282">
            <span class="mi" id="MathJax-Span-283">
             w
            </span>
            <span class="mn" id="MathJax-Span-284">
             3
            </span>
           </span>
           <span class="mo" id="MathJax-Span-285">
            .
           </span>
           <span class="mo" id="MathJax-Span-286">
            .
           </span>
           <span class="mo" id="MathJax-Span-287">
            .
           </span>
           <span class="msubsup" id="MathJax-Span-288">
            <span class="mi" id="MathJax-Span-289">
             w
            </span>
            <span class="mi" id="MathJax-Span-290">
             n
            </span>
           </span>
           <span class="mo" id="MathJax-Span-291">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        我们可以采用一元语言模型。它假定词语的出现是完全独立的，于是可以将整个概率拆开相乘：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-18-Frame">
         <span class="math" id="MathJax-Span-292">
          <span class="mrow" id="MathJax-Span-293">
           <span class="mi" id="MathJax-Span-294">
            P
           </span>
           <span class="mo" id="MathJax-Span-295">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-296">
            <span class="mi" id="MathJax-Span-297">
             w
            </span>
            <span class="mn" id="MathJax-Span-298">
             1
            </span>
           </span>
           <span class="mo" id="MathJax-Span-299">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-300">
            <span class="mi" id="MathJax-Span-301">
             w
            </span>
            <span class="mn" id="MathJax-Span-302">
             2
            </span>
           </span>
           <span class="mo" id="MathJax-Span-303">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-304">
            <span class="mi" id="MathJax-Span-305">
             w
            </span>
            <span class="mn" id="MathJax-Span-306">
             3
            </span>
           </span>
           <span class="mo" id="MathJax-Span-307">
            .
           </span>
           <span class="mo" id="MathJax-Span-308">
            .
           </span>
           <span class="mo" id="MathJax-Span-309">
            .
           </span>
           <span class="msubsup" id="MathJax-Span-310">
            <span class="mi" id="MathJax-Span-311">
             w
            </span>
            <span class="mi" id="MathJax-Span-312">
             n
            </span>
           </span>
           <span class="mo" id="MathJax-Span-313">
            )
           </span>
           <span class="mo" id="MathJax-Span-314">
            =
           </span>
           <span class="munderover" id="MathJax-Span-315">
            <span class="mo" id="MathJax-Span-316">
             ∏
            </span>
            <span class="texatom" id="MathJax-Span-317">
             <span class="mrow" id="MathJax-Span-318">
              <span class="mi" id="MathJax-Span-319">
               i
              </span>
              <span class="mo" id="MathJax-Span-320">
               =
              </span>
              <span class="mn" id="MathJax-Span-321">
               1
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-322">
             N
            </span>
           </span>
           <span class="mi" id="MathJax-Span-323">
            P
           </span>
           <span class="mo" id="MathJax-Span-324">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-325">
            <span class="mi" id="MathJax-Span-326">
             w
            </span>
            <span class="mi" id="MathJax-Span-327">
             i
            </span>
           </span>
           <span class="mo" id="MathJax-Span-328">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        看到这里，肯定很多同学就要喷了，这不对，词和词之间没有关联吗？确实，我们知道一句话中每一个词语都跟它前面的词语有很强的依赖关系，忽略这一点的话，一些完全无意义的句子，可能会有很高的概率。咱们稍微改一改，让一个词语的概率依赖于它前面一个词语。我们将这种模型称作bigram（2-gram，二元语言模型），表示为：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-19-Frame">
         <span class="math" id="MathJax-Span-329">
          <span class="mrow" id="MathJax-Span-330">
           <span class="mi" id="MathJax-Span-331">
            P
           </span>
           <span class="mo" id="MathJax-Span-332">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-333">
            <span class="mi" id="MathJax-Span-334">
             w
            </span>
            <span class="mn" id="MathJax-Span-335">
             1
            </span>
           </span>
           <span class="mo" id="MathJax-Span-336">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-337">
            <span class="mi" id="MathJax-Span-338">
             w
            </span>
            <span class="mn" id="MathJax-Span-339">
             2
            </span>
           </span>
           <span class="mo" id="MathJax-Span-340">
            ,
           </span>
           <span class="msubsup" id="MathJax-Span-341">
            <span class="mi" id="MathJax-Span-342">
             w
            </span>
            <span class="mn" id="MathJax-Span-343">
             3
            </span>
           </span>
           <span class="mo" id="MathJax-Span-344">
            .
           </span>
           <span class="mo" id="MathJax-Span-345">
            .
           </span>
           <span class="mo" id="MathJax-Span-346">
            .
           </span>
           <span class="msubsup" id="MathJax-Span-347">
            <span class="mi" id="MathJax-Span-348">
             w
            </span>
            <span class="mi" id="MathJax-Span-349">
             n
            </span>
           </span>
           <span class="mo" id="MathJax-Span-350">
            )
           </span>
           <span class="mo" id="MathJax-Span-351">
            =
           </span>
           <span class="munderover" id="MathJax-Span-352">
            <span class="mo" id="MathJax-Span-353">
             ∏
            </span>
            <span class="texatom" id="MathJax-Span-354">
             <span class="mrow" id="MathJax-Span-355">
              <span class="mi" id="MathJax-Span-356">
               i
              </span>
              <span class="mo" id="MathJax-Span-357">
               =
              </span>
              <span class="mn" id="MathJax-Span-358">
               2
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-359">
             N
            </span>
           </span>
           <span class="mi" id="MathJax-Span-360">
            P
           </span>
           <span class="mo" id="MathJax-Span-361">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-362">
            <span class="mi" id="MathJax-Span-363">
             w
            </span>
            <span class="mi" id="MathJax-Span-364">
             i
            </span>
           </span>
           <span class="texatom" id="MathJax-Span-365">
            <span class="mrow" id="MathJax-Span-366">
             <span class="mo" id="MathJax-Span-367">
              |
             </span>
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-368">
            <span class="mi" id="MathJax-Span-369">
             w
            </span>
            <span class="texatom" id="MathJax-Span-370">
             <span class="mrow" id="MathJax-Span-371">
              <span class="mi" id="MathJax-Span-372">
               i
              </span>
              <span class="mo" id="MathJax-Span-373">
               −
              </span>
              <span class="mn" id="MathJax-Span-374">
               1
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-375">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        看起来还是有点简单？恩，也对，我们只考虑一个词语依赖于其相邻的一个词语的关系，而不是考虑其依赖整个句子的情况。别着急，接下来将会看到，这种方法能让我们有非常显著的进步。考虑到前面 “词-词”矩阵的情况，我们至少可以算出两个词语共同出现的概率。但是，旧话重提，这仍然要求储存和计算一个非常的大数据集里面的全部信息。
        <br/>
        现在我们理解了“分词序列”的概率（其实就是N-gram语言模型啦），让我们观察一些能够学习到这些概率的例子。
       </p>
       <h4 id="42-连续词袋模型cbom">
        <p name="t7">
        </p>
        4.2 连续词袋模型（CBOM）
       </h4>
       <p>
        有种模型是以{“The”, “cat”, ’over”, “the’, “puddle”}为上下文，能够预测或产生它们中心的词语”jumped”，叫做连续词袋模型。
       </p>
       <p>
        上面是最粗粒度的描述，咱们来深入一点点，看点细节。
       </p>
       <p>
        首先，我们要建立模型的一些已知参数。它们就是将句子表示为一些one-hot向量，作为模型的输入，咱们记为x(c)吧。模型的输出记为y(c)吧。因为连续词袋模型只有一个输出，所以其实我们只需记录它为y。在我们上面举的例子中，y就是我们已经知道的（有标签的）中心词（如本例中的”jumped”）。
       </p>
       <p>
        好了，已知参数有了，现在我们一起来定义模型中的未知参数。我们建立两矩阵，
        <span class="MathJax" id="MathJax-Element-20-Frame">
         <span class="math" id="MathJax-Span-376">
          <span class="mrow" id="MathJax-Span-377">
           <span class="mi" id="MathJax-Span-378">
            V
           </span>
           <span class="mo" id="MathJax-Span-379">
            ∈
           </span>
           <span class="msubsup" id="MathJax-Span-380">
            <span class="mi" id="MathJax-Span-381">
             R
            </span>
            <span class="texatom" id="MathJax-Span-382">
             <span class="mrow" id="MathJax-Span-383">
              <span class="mi" id="MathJax-Span-384">
               n
              </span>
              <span class="mo" id="MathJax-Span-385">
               ∗
              </span>
              <span class="texatom" id="MathJax-Span-386">
               <span class="mrow" id="MathJax-Span-387">
                <span class="mo" id="MathJax-Span-388">
                 |
                </span>
               </span>
              </span>
              <span class="mi" id="MathJax-Span-389">
               V
              </span>
              <span class="texatom" id="MathJax-Span-390">
               <span class="mrow" id="MathJax-Span-391">
                <span class="mo" id="MathJax-Span-392">
                 |
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
        和
        <span class="MathJax" id="MathJax-Element-21-Frame">
         <span class="math" id="MathJax-Span-393">
          <span class="mrow" id="MathJax-Span-394">
           <span class="mi" id="MathJax-Span-395">
            U
           </span>
           <span class="mo" id="MathJax-Span-396">
            ∈
           </span>
           <span class="msubsup" id="MathJax-Span-397">
            <span class="mi" id="MathJax-Span-398">
             R
            </span>
            <span class="texatom" id="MathJax-Span-399">
             <span class="mrow" id="MathJax-Span-400">
              <span class="texatom" id="MathJax-Span-401">
               <span class="mrow" id="MathJax-Span-402">
                <span class="mo" id="MathJax-Span-403">
                 |
                </span>
               </span>
              </span>
              <span class="mi" id="MathJax-Span-404">
               V
              </span>
              <span class="texatom" id="MathJax-Span-405">
               <span class="mrow" id="MathJax-Span-406">
                <span class="mo" id="MathJax-Span-407">
                 |
                </span>
               </span>
              </span>
              <span class="mo" id="MathJax-Span-408">
               ∗
              </span>
              <span class="mi" id="MathJax-Span-409">
               n
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
        。其中的n是可以任意指定的，它用来定义我们“嵌入空间”（embedding space）的维度。V是输入词矩阵。当词语
        <span class="MathJax" id="MathJax-Element-22-Frame">
         <span class="math" id="MathJax-Span-410">
          <span class="mrow" id="MathJax-Span-411">
           <span class="msubsup" id="MathJax-Span-412">
            <span class="mi" id="MathJax-Span-413">
             w
            </span>
            <span class="mi" id="MathJax-Span-414">
             i
            </span>
           </span>
          </span>
         </span>
        </span>
        （译注：
        <span class="MathJax" id="MathJax-Element-23-Frame">
         <span class="math" id="MathJax-Span-415">
          <span class="mrow" id="MathJax-Span-416">
           <span class="msubsup" id="MathJax-Span-417">
            <span class="mi" id="MathJax-Span-418">
             w
            </span>
            <span class="mi" id="MathJax-Span-419">
             i
            </span>
           </span>
          </span>
         </span>
        </span>
        是只有第i维是1其他维是0的one-hot向量）作为模型的一个输入的时候，V的第i列就是它的n维“嵌入向量”（embedded vector）。我们将V的这一列表示为
        <span class="MathJax" id="MathJax-Element-24-Frame">
         <span class="math" id="MathJax-Span-420">
          <span class="mrow" id="MathJax-Span-421">
           <span class="msubsup" id="MathJax-Span-422">
            <span class="mi" id="MathJax-Span-423">
             v
            </span>
            <span class="mi" id="MathJax-Span-424">
             i
            </span>
           </span>
          </span>
         </span>
        </span>
        。类似的，U是输出矩阵。当
        <span class="MathJax" id="MathJax-Element-25-Frame">
         <span class="math" id="MathJax-Span-425">
          <span class="mrow" id="MathJax-Span-426">
           <span class="msubsup" id="MathJax-Span-427">
            <span class="mi" id="MathJax-Span-428">
             w
            </span>
            <span class="mi" id="MathJax-Span-429">
             j
            </span>
           </span>
          </span>
         </span>
        </span>
        作为模型输出的时候，U的第j行就是它的n维“嵌入向量”。我们将U的这一行表示为
        <span class="MathJax" id="MathJax-Element-26-Frame">
         <span class="math" id="MathJax-Span-430">
          <span class="mrow" id="MathJax-Span-431">
           <span class="msubsup" id="MathJax-Span-432">
            <span class="mi" id="MathJax-Span-433">
             u
            </span>
            <span class="mi" id="MathJax-Span-434">
             j
            </span>
           </span>
          </span>
         </span>
        </span>
        。要注意我们实际上对于每个词语
        <span class="MathJax" id="MathJax-Element-27-Frame">
         <span class="math" id="MathJax-Span-435">
          <span class="mrow" id="MathJax-Span-436">
           <span class="msubsup" id="MathJax-Span-437">
            <span class="mi" id="MathJax-Span-438">
             w
            </span>
            <span class="mi" id="MathJax-Span-439">
             i
            </span>
           </span>
          </span>
         </span>
        </span>
        学习了两个向量。（作为输入词的向量
        <span class="MathJax" id="MathJax-Element-28-Frame">
         <span class="math" id="MathJax-Span-440">
          <span class="mrow" id="MathJax-Span-441">
           <span class="msubsup" id="MathJax-Span-442">
            <span class="mi" id="MathJax-Span-443">
             v
            </span>
            <span class="mi" id="MathJax-Span-444">
             i
            </span>
           </span>
          </span>
         </span>
        </span>
        ，和作为输出词的向量
        <span class="MathJax" id="MathJax-Element-29-Frame">
         <span class="math" id="MathJax-Span-445">
          <span class="mrow" id="MathJax-Span-446">
           <span class="msubsup" id="MathJax-Span-447">
            <span class="mi" id="MathJax-Span-448">
             u
            </span>
            <span class="mi" id="MathJax-Span-449">
             j
            </span>
           </span>
          </span>
         </span>
        </span>
        ）。
       </p>
       <p>
        连续词袋模型（CBOM）中的各个记号：
       </p>
       <ul>
        <li>
         <span class="MathJax" id="MathJax-Element-30-Frame">
          <span class="math" id="MathJax-Span-450">
           <span class="mrow" id="MathJax-Span-451">
            <span class="msubsup" id="MathJax-Span-452">
             <span class="mi" id="MathJax-Span-453">
              w
             </span>
             <span class="mi" id="MathJax-Span-454">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         :单词表V中的第i个单词
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-31-Frame">
          <span class="math" id="MathJax-Span-455">
           <span class="mrow" id="MathJax-Span-456">
            <span class="mi" id="MathJax-Span-457">
             v
            </span>
            <span class="mo" id="MathJax-Span-458">
             ∈
            </span>
            <span class="msubsup" id="MathJax-Span-459">
             <span class="mi" id="MathJax-Span-460">
              R
             </span>
             <span class="texatom" id="MathJax-Span-461">
              <span class="mrow" id="MathJax-Span-462">
               <span class="mi" id="MathJax-Span-463">
                n
               </span>
               <span class="mo" id="MathJax-Span-464">
                ∗
               </span>
               <span class="texatom" id="MathJax-Span-465">
                <span class="mrow" id="MathJax-Span-466">
                 <span class="mo" id="MathJax-Span-467">
                  |
                 </span>
                </span>
               </span>
               <span class="mi" id="MathJax-Span-468">
                V
               </span>
               <span class="texatom" id="MathJax-Span-469">
                <span class="mrow" id="MathJax-Span-470">
                 <span class="mo" id="MathJax-Span-471">
                  |
                 </span>
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         ：输入词矩阵
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-32-Frame">
          <span class="math" id="MathJax-Span-472">
           <span class="mrow" id="MathJax-Span-473">
            <span class="msubsup" id="MathJax-Span-474">
             <span class="mi" id="MathJax-Span-475">
              v
             </span>
             <span class="mi" id="MathJax-Span-476">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         ：V的第i列，单词
         <span class="MathJax" id="MathJax-Element-33-Frame">
          <span class="math" id="MathJax-Span-477">
           <span class="mrow" id="MathJax-Span-478">
            <span class="msubsup" id="MathJax-Span-479">
             <span class="mi" id="MathJax-Span-480">
              w
             </span>
             <span class="mi" id="MathJax-Span-481">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         的输入向量
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-34-Frame">
          <span class="math" id="MathJax-Span-482">
           <span class="mrow" id="MathJax-Span-483">
            <span class="mi" id="MathJax-Span-484">
             u
            </span>
            <span class="mo" id="MathJax-Span-485">
             ∈
            </span>
            <span class="msubsup" id="MathJax-Span-486">
             <span class="mi" id="MathJax-Span-487">
              R
             </span>
             <span class="texatom" id="MathJax-Span-488">
              <span class="mrow" id="MathJax-Span-489">
               <span class="texatom" id="MathJax-Span-490">
                <span class="mrow" id="MathJax-Span-491">
                 <span class="mo" id="MathJax-Span-492">
                  |
                 </span>
                </span>
               </span>
               <span class="mi" id="MathJax-Span-493">
                V
               </span>
               <span class="texatom" id="MathJax-Span-494">
                <span class="mrow" id="MathJax-Span-495">
                 <span class="mo" id="MathJax-Span-496">
                  |
                 </span>
                </span>
               </span>
               <span class="mo" id="MathJax-Span-497">
                ∗
               </span>
               <span class="mi" id="MathJax-Span-498">
                n
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         ：输出词矩阵
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-35-Frame">
          <span class="math" id="MathJax-Span-499">
           <span class="mrow" id="MathJax-Span-500">
            <span class="msubsup" id="MathJax-Span-501">
             <span class="mi" id="MathJax-Span-502">
              u
             </span>
             <span class="mi" id="MathJax-Span-503">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         ：U的第i行，单词
         <span class="MathJax" id="MathJax-Element-36-Frame">
          <span class="math" id="MathJax-Span-504">
           <span class="mrow" id="MathJax-Span-505">
            <span class="msubsup" id="MathJax-Span-506">
             <span class="mi" id="MathJax-Span-507">
              w
             </span>
             <span class="mi" id="MathJax-Span-508">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         的输出向量
        </li>
       </ul>
       <p>
        那这个模型是如何运作的呢？我们把整个过程拆分成以下几步：
       </p>
       <ol>
        <li>
         对于m个词长度的输入上下文，我们产生它们的one-hot向量（
         <span class="MathJax" id="MathJax-Element-37-Frame">
          <span class="math" id="MathJax-Span-509">
           <span class="mrow" id="MathJax-Span-510">
            <span class="msubsup" id="MathJax-Span-511">
             <span class="mi" id="MathJax-Span-512">
              x
             </span>
             <span class="texatom" id="MathJax-Span-513">
              <span class="mrow" id="MathJax-Span-514">
               <span class="mo" id="MathJax-Span-515">
                (
               </span>
               <span class="mi" id="MathJax-Span-516">
                c
               </span>
               <span class="mo" id="MathJax-Span-517">
                −
               </span>
               <span class="mi" id="MathJax-Span-518">
                m
               </span>
               <span class="mo" id="MathJax-Span-519">
                )
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-520">
             ,
            </span>
            <span class="mo" id="MathJax-Span-521">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-522">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-523">
             <span class="mi" id="MathJax-Span-524">
              x
             </span>
             <span class="texatom" id="MathJax-Span-525">
              <span class="mrow" id="MathJax-Span-526">
               <span class="mo" id="MathJax-Span-527">
                (
               </span>
               <span class="mi" id="MathJax-Span-528">
                c
               </span>
               <span class="mo" id="MathJax-Span-529">
                −
               </span>
               <span class="mn" id="MathJax-Span-530">
                1
               </span>
               <span class="mo" id="MathJax-Span-531">
                )
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-532">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-533">
             <span class="mi" id="MathJax-Span-534">
              x
             </span>
             <span class="texatom" id="MathJax-Span-535">
              <span class="mrow" id="MathJax-Span-536">
               <span class="mo" id="MathJax-Span-537">
                (
               </span>
               <span class="mi" id="MathJax-Span-538">
                c
               </span>
               <span class="mo" id="MathJax-Span-539">
                +
               </span>
               <span class="mn" id="MathJax-Span-540">
                1
               </span>
               <span class="mo" id="MathJax-Span-541">
                )
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-542">
             ,
            </span>
            <span class="mo" id="MathJax-Span-543">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-544">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-545">
             <span class="mi" id="MathJax-Span-546">
              x
             </span>
             <span class="texatom" id="MathJax-Span-547">
              <span class="mrow" id="MathJax-Span-548">
               <span class="mo" id="MathJax-Span-549">
                (
               </span>
               <span class="mi" id="MathJax-Span-550">
                c
               </span>
               <span class="mo" id="MathJax-Span-551">
                +
               </span>
               <span class="mi" id="MathJax-Span-552">
                m
               </span>
               <span class="mo" id="MathJax-Span-553">
                )
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         ）。
        </li>
        <li>
         我们得到上下文的嵌入词向量（
         <span class="MathJax" id="MathJax-Element-38-Frame">
          <span class="math" id="MathJax-Span-554">
           <span class="mrow" id="MathJax-Span-555">
            <span class="msubsup" id="MathJax-Span-556">
             <span class="mi" id="MathJax-Span-557">
              v
             </span>
             <span class="texatom" id="MathJax-Span-558">
              <span class="mrow" id="MathJax-Span-559">
               <span class="mi" id="MathJax-Span-560">
                c
               </span>
               <span class="mo" id="MathJax-Span-561">
                −
               </span>
               <span class="mi" id="MathJax-Span-562">
                m
               </span>
               <span class="mo" id="MathJax-Span-563">
                +
               </span>
               <span class="mn" id="MathJax-Span-564">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-565">
             =
            </span>
            <span class="mi" id="MathJax-Span-566">
             V
            </span>
            <span class="msubsup" id="MathJax-Span-567">
             <span class="mi" id="MathJax-Span-568">
              x
             </span>
             <span class="texatom" id="MathJax-Span-569">
              <span class="mrow" id="MathJax-Span-570">
               <span class="mo" id="MathJax-Span-571">
                (
               </span>
               <span class="mi" id="MathJax-Span-572">
                c
               </span>
               <span class="mo" id="MathJax-Span-573">
                −
               </span>
               <span class="mi" id="MathJax-Span-574">
                m
               </span>
               <span class="mo" id="MathJax-Span-575">
                +
               </span>
               <span class="mn" id="MathJax-Span-576">
                1
               </span>
               <span class="mo" id="MathJax-Span-577">
                )
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-578">
             ,
            </span>
            <span class="mo" id="MathJax-Span-579">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-580">
             ,
            </span>
           </span>
          </span>
         </span>
         v_{c+m}=Vx^{(c+m)}）
        </li>
        <li>
         将这些向量取平均
         <span class="MathJax" id="MathJax-Element-39-Frame">
          <span class="math" id="MathJax-Span-581">
           <span class="mrow" id="MathJax-Span-582">
            <span class="texatom" id="MathJax-Span-583">
             <span class="mrow" id="MathJax-Span-584">
              <span class="munderover" id="MathJax-Span-585">
               <span class="mi" id="MathJax-Span-586">
                v
               </span>
               <span class="mo" id="MathJax-Span-587">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-588">
             =
            </span>
            <span class="texatom" id="MathJax-Span-589">
             <span class="mrow" id="MathJax-Span-590">
              <span class="mfrac" id="MathJax-Span-591">
               <span class="mrow" id="MathJax-Span-592">
                <span class="msubsup" id="MathJax-Span-593">
                 <span class="mi" id="MathJax-Span-594">
                  v
                 </span>
                 <span class="texatom" id="MathJax-Span-595">
                  <span class="mrow" id="MathJax-Span-596">
                   <span class="mi" id="MathJax-Span-597">
                    c
                   </span>
                   <span class="mo" id="MathJax-Span-598">
                    −
                   </span>
                   <span class="mi" id="MathJax-Span-599">
                    m
                   </span>
                  </span>
                 </span>
                </span>
                <span class="mo" id="MathJax-Span-600">
                 +
                </span>
                <span class="msubsup" id="MathJax-Span-601">
                 <span class="mi" id="MathJax-Span-602">
                  v
                 </span>
                 <span class="texatom" id="MathJax-Span-603">
                  <span class="mrow" id="MathJax-Span-604">
                   <span class="mi" id="MathJax-Span-605">
                    c
                   </span>
                   <span class="mo" id="MathJax-Span-606">
                    −
                   </span>
                   <span class="mi" id="MathJax-Span-607">
                    m
                   </span>
                   <span class="mo" id="MathJax-Span-608">
                    +
                   </span>
                   <span class="mn" id="MathJax-Span-609">
                    1
                   </span>
                  </span>
                 </span>
                </span>
                <span class="mo" id="MathJax-Span-610">
                 +
                </span>
                <span class="mo" id="MathJax-Span-611">
                 ⋯
                </span>
                <span class="mo" id="MathJax-Span-612">
                 +
                </span>
                <span class="msubsup" id="MathJax-Span-613">
                 <span class="mi" id="MathJax-Span-614">
                  v
                 </span>
                 <span class="texatom" id="MathJax-Span-615">
                  <span class="mrow" id="MathJax-Span-616">
                   <span class="mi" id="MathJax-Span-617">
                    c
                   </span>
                   <span class="mo" id="MathJax-Span-618">
                    +
                   </span>
                   <span class="mi" id="MathJax-Span-619">
                    m
                   </span>
                  </span>
                 </span>
                </span>
               </span>
               <span class="mrow" id="MathJax-Span-620">
                <span class="mn" id="MathJax-Span-621">
                 2
                </span>
                <span class="mi" id="MathJax-Span-622">
                 m
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </li>
        <li>
         产生一个得分向量
         <span class="MathJax" id="MathJax-Element-40-Frame">
          <span class="math" id="MathJax-Span-623">
           <span class="mrow" id="MathJax-Span-624">
            <span class="mi" id="MathJax-Span-625">
             z
            </span>
            <span class="mo" id="MathJax-Span-626">
             =
            </span>
            <span class="mi" id="MathJax-Span-627">
             U
            </span>
            <span class="texatom" id="MathJax-Span-628">
             <span class="mrow" id="MathJax-Span-629">
              <span class="munderover" id="MathJax-Span-630">
               <span class="mi" id="MathJax-Span-631">
                v
               </span>
               <span class="mo" id="MathJax-Span-632">
                ^
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </li>
        <li>
         将得分向量转换成概率分布形式
         <span class="MathJax" id="MathJax-Element-41-Frame">
          <span class="math" id="MathJax-Span-633">
           <span class="mrow" id="MathJax-Span-634">
            <span class="texatom" id="MathJax-Span-635">
             <span class="mrow" id="MathJax-Span-636">
              <span class="munderover" id="MathJax-Span-637">
               <span class="mi" id="MathJax-Span-638">
                y
               </span>
               <span class="mo" id="MathJax-Span-639">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-640">
             =
            </span>
            <span class="mi" id="MathJax-Span-641">
             s
            </span>
            <span class="mi" id="MathJax-Span-642">
             o
            </span>
            <span class="mi" id="MathJax-Span-643">
             f
            </span>
            <span class="mi" id="MathJax-Span-644">
             t
            </span>
            <span class="mi" id="MathJax-Span-645">
             m
            </span>
            <span class="mi" id="MathJax-Span-646">
             a
            </span>
            <span class="mi" id="MathJax-Span-647">
             x
            </span>
            <span class="mo" id="MathJax-Span-648">
             (
            </span>
            <span class="mi" id="MathJax-Span-649">
             z
            </span>
            <span class="mo" id="MathJax-Span-650">
             )
            </span>
           </span>
          </span>
         </span>
        </li>
        <li>
         我们希望我们产生的概率分布 ,与真实概率分布
         <span class="MathJax" id="MathJax-Element-42-Frame">
          <span class="math" id="MathJax-Span-651">
           <span class="mrow" id="MathJax-Span-652">
            <span class="texatom" id="MathJax-Span-653">
             <span class="mrow" id="MathJax-Span-654">
              <span class="munderover" id="MathJax-Span-655">
               <span class="mi" id="MathJax-Span-656">
                y
               </span>
               <span class="mo" id="MathJax-Span-657">
                ^
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         相匹配。而
         <span class="MathJax" id="MathJax-Element-43-Frame">
          <span class="math" id="MathJax-Span-658">
           <span class="mrow" id="MathJax-Span-659">
            <span class="mi" id="MathJax-Span-660">
             y
            </span>
           </span>
          </span>
         </span>
         刚好也就是我们期望的真实词语的one-hot向量。
        </li>
       </ol>
       <p>
        用一幅图来表示就是下面这个样子：
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://i.stack.imgur.com/fYxO9.png"/>
       </center>
       通过上面说的种种步骤，我们知道有了矩阵U、V整个过程是如何运作的，那我们怎样找到U和V呢？——我们需要有一个目标函数。通常来说，当我们试图从已知概率学习一个新的概率时，最常见的是从信息论的角度寻找方法来评估两个概率分布的差距。其中广受好评又广泛应用的一个评估差异/损失的函数是交叉熵：
       <p>
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-44-Frame">
         <span class="math" id="MathJax-Span-661">
          <span class="mrow" id="MathJax-Span-662">
           <span class="mi" id="MathJax-Span-663">
            H
           </span>
           <span class="mo" id="MathJax-Span-664">
            (
           </span>
           <span class="texatom" id="MathJax-Span-665">
            <span class="mrow" id="MathJax-Span-666">
             <span class="munderover" id="MathJax-Span-667">
              <span class="mi" id="MathJax-Span-668">
               y
              </span>
              <span class="mo" id="MathJax-Span-669">
               ^
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-670">
            ,
           </span>
           <span class="mi" id="MathJax-Span-671">
            y
           </span>
           <span class="mo" id="MathJax-Span-672">
            )
           </span>
           <span class="mo" id="MathJax-Span-673">
            =
           </span>
           <span class="mo" id="MathJax-Span-674">
            −
           </span>
           <span class="munderover" id="MathJax-Span-675">
            <span class="mo" id="MathJax-Span-676">
             ∑
            </span>
            <span class="texatom" id="MathJax-Span-677">
             <span class="mrow" id="MathJax-Span-678">
              <span class="mi" id="MathJax-Span-679">
               j
              </span>
              <span class="mo" id="MathJax-Span-680">
               =
              </span>
              <span class="mn" id="MathJax-Span-681">
               1
              </span>
             </span>
            </span>
            <span class="texatom" id="MathJax-Span-682">
             <span class="mrow" id="MathJax-Span-683">
              <span class="texatom" id="MathJax-Span-684">
               <span class="mrow" id="MathJax-Span-685">
                <span class="mo" id="MathJax-Span-686">
                 |
                </span>
               </span>
              </span>
              <span class="mi" id="MathJax-Span-687">
               V
              </span>
              <span class="texatom" id="MathJax-Span-688">
               <span class="mrow" id="MathJax-Span-689">
                <span class="mo" id="MathJax-Span-690">
                 |
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
           <span class="msubsup" id="MathJax-Span-691">
            <span class="mi" id="MathJax-Span-692">
             y
            </span>
            <span class="mi" id="MathJax-Span-693">
             j
            </span>
           </span>
           <span class="mi" id="MathJax-Span-694">
            l
           </span>
           <span class="mi" id="MathJax-Span-695">
            o
           </span>
           <span class="mi" id="MathJax-Span-696">
            g
           </span>
           <span class="mo" id="MathJax-Span-697">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-698">
            <span class="texatom" id="MathJax-Span-699">
             <span class="mrow" id="MathJax-Span-700">
              <span class="munderover" id="MathJax-Span-701">
               <span class="mi" id="MathJax-Span-702">
                y
               </span>
               <span class="mo" id="MathJax-Span-703">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-704">
             j
            </span>
           </span>
           <span class="mo" id="MathJax-Span-705">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        结合我们当下的例子，y只是一个one-hot向量，于是上面的损失函数就可以简化为：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-45-Frame">
         <span class="math" id="MathJax-Span-706">
          <span class="mrow" id="MathJax-Span-707">
           <span class="mi" id="MathJax-Span-708">
            H
           </span>
           <span class="mo" id="MathJax-Span-709">
            (
           </span>
           <span class="texatom" id="MathJax-Span-710">
            <span class="mrow" id="MathJax-Span-711">
             <span class="munderover" id="MathJax-Span-712">
              <span class="mi" id="MathJax-Span-713">
               y
              </span>
              <span class="mo" id="MathJax-Span-714">
               ^
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-715">
            ,
           </span>
           <span class="mi" id="MathJax-Span-716">
            y
           </span>
           <span class="mo" id="MathJax-Span-717">
            )
           </span>
           <span class="mo" id="MathJax-Span-718">
            =
           </span>
           <span class="mo" id="MathJax-Span-719">
            −
           </span>
           <span class="msubsup" id="MathJax-Span-720">
            <span class="mi" id="MathJax-Span-721">
             y
            </span>
            <span class="mi" id="MathJax-Span-722">
             i
            </span>
           </span>
           <span class="mi" id="MathJax-Span-723">
            l
           </span>
           <span class="mi" id="MathJax-Span-724">
            o
           </span>
           <span class="mi" id="MathJax-Span-725">
            g
           </span>
           <span class="mo" id="MathJax-Span-726">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-727">
            <span class="texatom" id="MathJax-Span-728">
             <span class="mrow" id="MathJax-Span-729">
              <span class="munderover" id="MathJax-Span-730">
               <span class="mi" id="MathJax-Span-731">
                y
               </span>
               <span class="mo" id="MathJax-Span-732">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-733">
             i
            </span>
           </span>
           <span class="mo" id="MathJax-Span-734">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        我们用c表示y这个one-hot向量取值为1的那个维度的下标。所以在我们预测为准确值的情况下
        <span class="MathJax" id="MathJax-Element-46-Frame">
         <span class="math" id="MathJax-Span-735">
          <span class="mrow" id="MathJax-Span-736">
           <span class="msubsup" id="MathJax-Span-737">
            <span class="texatom" id="MathJax-Span-738">
             <span class="mrow" id="MathJax-Span-739">
              <span class="munderover" id="MathJax-Span-740">
               <span class="mi" id="MathJax-Span-741">
                y
               </span>
               <span class="mo" id="MathJax-Span-742">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-743">
             c
            </span>
           </span>
           <span class="mo" id="MathJax-Span-744">
            =
           </span>
           <span class="mn" id="MathJax-Span-745">
            1
           </span>
          </span>
         </span>
        </span>
        。于是损失为 −1 log(1) = 0。所以对于一个理想的预测值，因为预测得到的概率分布和真实概率分布完全一样，因此损失为0。现在让我们看一个相反的情况，也就是我们的预测结果非常不理想，此时
        <span class="MathJax" id="MathJax-Element-47-Frame">
         <span class="math" id="MathJax-Span-746">
          <span class="mrow" id="MathJax-Span-747">
           <span class="msubsup" id="MathJax-Span-748">
            <span class="texatom" id="MathJax-Span-749">
             <span class="mrow" id="MathJax-Span-750">
              <span class="munderover" id="MathJax-Span-751">
               <span class="mi" id="MathJax-Span-752">
                y
               </span>
               <span class="mo" id="MathJax-Span-753">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-754">
             c
            </span>
           </span>
           <span class="mo" id="MathJax-Span-755">
            =
           </span>
           <span class="mn" id="MathJax-Span-756">
            0.01
           </span>
          </span>
         </span>
        </span>
        。计算得到的损失为−1 log(0.01) ≈ 4.605，损失非常大，原本这才是标准结果，可是你给了一个非常低的概率，因此会拿到一个非常大的loss 。可见交叉熵为我们提供了一个很好的衡量两个概率分布的差异的方法。于是我们最终的优化函数为：
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_7.png?imageView/2/w/450/q/100"/>
       </center>
       <br/>
       我们用梯度下降法去更新每一个相关的词向量
       <span class="MathJax" id="MathJax-Element-48-Frame">
        <span class="math" id="MathJax-Span-757">
         <span class="mrow" id="MathJax-Span-758">
          <span class="msubsup" id="MathJax-Span-759">
           <span class="mi" id="MathJax-Span-760">
            u
           </span>
           <span class="mi" id="MathJax-Span-761">
            c
           </span>
          </span>
         </span>
        </span>
       </span>
       和
       <span class="MathJax" id="MathJax-Element-49-Frame">
        <span class="math" id="MathJax-Span-762">
         <span class="mrow" id="MathJax-Span-763">
          <span class="msubsup" id="MathJax-Span-764">
           <span class="mi" id="MathJax-Span-765">
            v
           </span>
           <span class="mi" id="MathJax-Span-766">
            j
           </span>
          </span>
         </span>
        </span>
       </span>
       。
       <p>
       </p>
       <h4 id="43-skip-gram-模型">
        <p name="t8">
        </p>
        4.3 Skip-Gram 模型
       </h4>
       <p>
        很上面提到的模型对应的另一种思路，是以中心的词语”jumped”为输入，能够预测或产生它周围的词语”The”, “cat”, ’over”, “the”, “puddle”等。这里我们叫”jumped”为上下文。我们把它叫做Skip-Gram 模型。
        <br/>
        这个模型的建立与连续词袋模型（CBOM）非常相似，但本质上是交换了输入和输出的位置。我们令输入的one-hot向量（中心词）为x（因为它只有一个），输出向量为y(j)。U和V的定义与连续词袋模型一样。
       </p>
       <p>
        Skip-Gram 模型中的各个记号：
       </p>
       <ul>
        <li>
         <span class="MathJax" id="MathJax-Element-50-Frame">
          <span class="math" id="MathJax-Span-767">
           <span class="mrow" id="MathJax-Span-768">
            <span class="msubsup" id="MathJax-Span-769">
             <span class="mi" id="MathJax-Span-770">
              w
             </span>
             <span class="mi" id="MathJax-Span-771">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         :单词表V中的第i个单词
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-51-Frame">
          <span class="math" id="MathJax-Span-772">
           <span class="mrow" id="MathJax-Span-773">
            <span class="mi" id="MathJax-Span-774">
             v
            </span>
            <span class="mo" id="MathJax-Span-775">
             ∈
            </span>
            <span class="msubsup" id="MathJax-Span-776">
             <span class="mi" id="MathJax-Span-777">
              R
             </span>
             <span class="texatom" id="MathJax-Span-778">
              <span class="mrow" id="MathJax-Span-779">
               <span class="mi" id="MathJax-Span-780">
                n
               </span>
               <span class="mo" id="MathJax-Span-781">
                ∗
               </span>
               <span class="texatom" id="MathJax-Span-782">
                <span class="mrow" id="MathJax-Span-783">
                 <span class="mo" id="MathJax-Span-784">
                  |
                 </span>
                </span>
               </span>
               <span class="mi" id="MathJax-Span-785">
                V
               </span>
               <span class="texatom" id="MathJax-Span-786">
                <span class="mrow" id="MathJax-Span-787">
                 <span class="mo" id="MathJax-Span-788">
                  |
                 </span>
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         ：输入词矩阵
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-52-Frame">
          <span class="math" id="MathJax-Span-789">
           <span class="mrow" id="MathJax-Span-790">
            <span class="msubsup" id="MathJax-Span-791">
             <span class="mi" id="MathJax-Span-792">
              v
             </span>
             <span class="mi" id="MathJax-Span-793">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         ：V的第i列，单词
         <span class="MathJax" id="MathJax-Element-53-Frame">
          <span class="math" id="MathJax-Span-794">
           <span class="mrow" id="MathJax-Span-795">
            <span class="msubsup" id="MathJax-Span-796">
             <span class="mi" id="MathJax-Span-797">
              w
             </span>
             <span class="mi" id="MathJax-Span-798">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         的输入向量
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-54-Frame">
          <span class="math" id="MathJax-Span-799">
           <span class="mrow" id="MathJax-Span-800">
            <span class="mi" id="MathJax-Span-801">
             u
            </span>
            <span class="mo" id="MathJax-Span-802">
             ∈
            </span>
            <span class="msubsup" id="MathJax-Span-803">
             <span class="mi" id="MathJax-Span-804">
              R
             </span>
             <span class="texatom" id="MathJax-Span-805">
              <span class="mrow" id="MathJax-Span-806">
               <span class="texatom" id="MathJax-Span-807">
                <span class="mrow" id="MathJax-Span-808">
                 <span class="mo" id="MathJax-Span-809">
                  |
                 </span>
                </span>
               </span>
               <span class="mi" id="MathJax-Span-810">
                V
               </span>
               <span class="texatom" id="MathJax-Span-811">
                <span class="mrow" id="MathJax-Span-812">
                 <span class="mo" id="MathJax-Span-813">
                  |
                 </span>
                </span>
               </span>
               <span class="mo" id="MathJax-Span-814">
                ∗
               </span>
               <span class="mi" id="MathJax-Span-815">
                n
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         ：输出词矩阵
        </li>
        <li>
         <span class="MathJax" id="MathJax-Element-55-Frame">
          <span class="math" id="MathJax-Span-816">
           <span class="mrow" id="MathJax-Span-817">
            <span class="msubsup" id="MathJax-Span-818">
             <span class="mi" id="MathJax-Span-819">
              u
             </span>
             <span class="mi" id="MathJax-Span-820">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         ：U的第i行，单词
         <span class="MathJax" id="MathJax-Element-56-Frame">
          <span class="math" id="MathJax-Span-821">
           <span class="mrow" id="MathJax-Span-822">
            <span class="msubsup" id="MathJax-Span-823">
             <span class="mi" id="MathJax-Span-824">
              w
             </span>
             <span class="mi" id="MathJax-Span-825">
              i
             </span>
            </span>
           </span>
          </span>
         </span>
         的输出向量
        </li>
       </ul>
       <p>
        对应到上面部分，我们可以把Skip-Gram 模型的运作方式拆分成以下几步：
       </p>
       <ol>
        <li>
         生成one-hot输入向量x。
        </li>
        <li>
         得到上下文的嵌入词向量
         <span class="MathJax" id="MathJax-Element-57-Frame">
          <span class="math" id="MathJax-Span-826">
           <span class="mrow" id="MathJax-Span-827">
            <span class="msubsup" id="MathJax-Span-828">
             <span class="mi" id="MathJax-Span-829">
              v
             </span>
             <span class="mi" id="MathJax-Span-830">
              c
             </span>
            </span>
            <span class="mo" id="MathJax-Span-831">
             =
            </span>
            <span class="mi" id="MathJax-Span-832">
             V
            </span>
            <span class="mi" id="MathJax-Span-833">
             x
            </span>
           </span>
          </span>
         </span>
         。
        </li>
        <li>
         因为这里不需要取平均值的操作，所以直接是
         <span class="MathJax" id="MathJax-Element-58-Frame">
          <span class="math" id="MathJax-Span-834">
           <span class="mrow" id="MathJax-Span-835">
            <span class="texatom" id="MathJax-Span-836">
             <span class="mrow" id="MathJax-Span-837">
              <span class="munderover" id="MathJax-Span-838">
               <span class="mi" id="MathJax-Span-839">
                v
               </span>
               <span class="mo" id="MathJax-Span-840">
                ^
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-841">
             =
            </span>
            <span class="msubsup" id="MathJax-Span-842">
             <span class="mi" id="MathJax-Span-843">
              v
             </span>
             <span class="mi" id="MathJax-Span-844">
              c
             </span>
            </span>
           </span>
          </span>
         </span>
         。
        </li>
        <li>
         通过
         <span class="MathJax" id="MathJax-Element-59-Frame">
          <span class="math" id="MathJax-Span-845">
           <span class="mrow" id="MathJax-Span-846">
            <span class="mi" id="MathJax-Span-847">
             u
            </span>
            <span class="mo" id="MathJax-Span-848">
             =
            </span>
            <span class="mi" id="MathJax-Span-849">
             U
            </span>
            <span class="msubsup" id="MathJax-Span-850">
             <span class="mi" id="MathJax-Span-851">
              v
             </span>
             <span class="mi" id="MathJax-Span-852">
              c
             </span>
            </span>
           </span>
          </span>
         </span>
         产生2m个得分向量
         <span class="MathJax" id="MathJax-Element-60-Frame">
          <span class="math" id="MathJax-Span-853">
           <span class="mrow" id="MathJax-Span-854">
            <span class="msubsup" id="MathJax-Span-855">
             <span class="mi" id="MathJax-Span-856">
              u
             </span>
             <span class="texatom" id="MathJax-Span-857">
              <span class="mrow" id="MathJax-Span-858">
               <span class="mi" id="MathJax-Span-859">
                c
               </span>
               <span class="mo" id="MathJax-Span-860">
                −
               </span>
               <span class="mi" id="MathJax-Span-861">
                m
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-862">
             ,
            </span>
            <span class="mo" id="MathJax-Span-863">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-864">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-865">
             <span class="mi" id="MathJax-Span-866">
              u
             </span>
             <span class="texatom" id="MathJax-Span-867">
              <span class="mrow" id="MathJax-Span-868">
               <span class="mi" id="MathJax-Span-869">
                c
               </span>
               <span class="mo" id="MathJax-Span-870">
                −
               </span>
               <span class="mn" id="MathJax-Span-871">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-872">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-873">
             <span class="mi" id="MathJax-Span-874">
              u
             </span>
             <span class="texatom" id="MathJax-Span-875">
              <span class="mrow" id="MathJax-Span-876">
               <span class="mi" id="MathJax-Span-877">
                c
               </span>
               <span class="mo" id="MathJax-Span-878">
                +
               </span>
               <span class="mn" id="MathJax-Span-879">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-880">
             ,
            </span>
            <span class="mo" id="MathJax-Span-881">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-882">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-883">
             <span class="mi" id="MathJax-Span-884">
              u
             </span>
             <span class="texatom" id="MathJax-Span-885">
              <span class="mrow" id="MathJax-Span-886">
               <span class="mo" id="MathJax-Span-887">
                (
               </span>
               <span class="mi" id="MathJax-Span-888">
                c
               </span>
               <span class="mo" id="MathJax-Span-889">
                +
               </span>
               <span class="mi" id="MathJax-Span-890">
                m
               </span>
               <span class="mo" id="MathJax-Span-891">
                )
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         。
        </li>
        <li>
         将得分向量转换成概率分布形式
         <span class="MathJax" id="MathJax-Element-61-Frame">
          <span class="math" id="MathJax-Span-892">
           <span class="mrow" id="MathJax-Span-893">
            <span class="mi" id="MathJax-Span-894">
             y
            </span>
            <span class="mo" id="MathJax-Span-895">
             =
            </span>
            <span class="mi" id="MathJax-Span-896">
             s
            </span>
            <span class="mi" id="MathJax-Span-897">
             o
            </span>
            <span class="mi" id="MathJax-Span-898">
             f
            </span>
            <span class="mi" id="MathJax-Span-899">
             t
            </span>
            <span class="mi" id="MathJax-Span-900">
             m
            </span>
            <span class="mi" id="MathJax-Span-901">
             a
            </span>
            <span class="mi" id="MathJax-Span-902">
             x
            </span>
            <span class="mo" id="MathJax-Span-903">
             (
            </span>
            <span class="mi" id="MathJax-Span-904">
             u
            </span>
            <span class="mo" id="MathJax-Span-905">
             )
            </span>
           </span>
          </span>
         </span>
         。
        </li>
        <li>
         我们希望我们产生的概率分布与真实概率分布
         <span class="MathJax" id="MathJax-Element-62-Frame">
          <span class="math" id="MathJax-Span-906">
           <span class="mrow" id="MathJax-Span-907">
            <span class="msubsup" id="MathJax-Span-908">
             <span class="mi" id="MathJax-Span-909">
              y
             </span>
             <span class="texatom" id="MathJax-Span-910">
              <span class="mrow" id="MathJax-Span-911">
               <span class="mi" id="MathJax-Span-912">
                c
               </span>
               <span class="mo" id="MathJax-Span-913">
                −
               </span>
               <span class="mi" id="MathJax-Span-914">
                m
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-915">
             ,
            </span>
            <span class="mo" id="MathJax-Span-916">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-917">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-918">
             <span class="mi" id="MathJax-Span-919">
              y
             </span>
             <span class="texatom" id="MathJax-Span-920">
              <span class="mrow" id="MathJax-Span-921">
               <span class="mi" id="MathJax-Span-922">
                c
               </span>
               <span class="mo" id="MathJax-Span-923">
                −
               </span>
               <span class="mn" id="MathJax-Span-924">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-925">
             ,
            </span>
            <span class="mo" id="MathJax-Span-926">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-927">
             <span class="mi" id="MathJax-Span-928">
              y
             </span>
             <span class="texatom" id="MathJax-Span-929">
              <span class="mrow" id="MathJax-Span-930">
               <span class="mi" id="MathJax-Span-931">
                c
               </span>
               <span class="mo" id="MathJax-Span-932">
                +
               </span>
               <span class="mn" id="MathJax-Span-933">
                1
               </span>
              </span>
             </span>
            </span>
            <span class="mo" id="MathJax-Span-934">
             ⋯
            </span>
            <span class="mo" id="MathJax-Span-935">
             ,
            </span>
            <span class="msubsup" id="MathJax-Span-936">
             <span class="mi" id="MathJax-Span-937">
              y
             </span>
             <span class="texatom" id="MathJax-Span-938">
              <span class="mrow" id="MathJax-Span-939">
               <span class="mi" id="MathJax-Span-940">
                c
               </span>
               <span class="mo" id="MathJax-Span-941">
                +
               </span>
               <span class="mi" id="MathJax-Span-942">
                m
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
         相匹配，也就是我们真实输出结果的one-hot向量。
        </li>
       </ol>
       <p>
        用一幅图来表示这个过程如下：
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://i.stack.imgur.com/igSuE.png"/>
       </center>
       <br/>
       像连续词袋模型一样，我们需要为模型设定一个目标/损失函数。不过不同的地方是我们这里需要引入朴素贝叶斯假设来将联合概率拆分成独立概率相乘。如果你之前不了解它，可以先跳过。这是一个非常强的条件独立性假设。也就是说只要给出了中心词，所有的输出词是完全独立的。
       <p>
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_8.png?imageView/2/w/460/q/100"/>
       </center>
       <br/>
       我们可以用随机梯度下降法去更新未知参数的梯度。
       <p>
       </p>
       <h4 id="44-负面抽样negative-sampling">
        <p name="t9">
        </p>
        4.4 负面抽样（Negative Sampling）
       </h4>
       <p>
        我们再次观察一下目标函数，注意到对整个单词表|V|求和的计算量是非常巨大的，任何一个对目标函数的更新和求值操作都会有O(|V|)的时间复杂度。我们需要一个思路去简化一下，我们想办法去求它的近似。
        <br/>
        对于每一步训练，我们不去循环整个单词表，而只是抽象一些负面例子就够了！我们可以从一个噪声分布
        <span class="MathJax" id="MathJax-Element-63-Frame">
         <span class="math" id="MathJax-Span-943">
          <span class="mrow" id="MathJax-Span-944">
           <span class="mo" id="MathJax-Span-945">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-946">
            <span class="mi" id="MathJax-Span-947">
             P
            </span>
            <span class="mi" id="MathJax-Span-948">
             n
            </span>
           </span>
           <span class="mo" id="MathJax-Span-949">
            (
           </span>
           <span class="mi" id="MathJax-Span-950">
            w
           </span>
           <span class="mo" id="MathJax-Span-951">
            )
           </span>
           <span class="mo" id="MathJax-Span-952">
            )
           </span>
          </span>
         </span>
        </span>
        中抽样，其概率分布与单词表中的频率相匹配。为了将描述问题的公式与负面抽样相结合，我们只需要更新我们的：
       </p>
       <ul>
        <li>
         目标函数
        </li>
        <li>
         梯度
        </li>
        <li>
         更新规则
        </li>
       </ul>
       <p>
        Mikolov ET AL.在他的《Distributed Representations of Words and Phrases and their Compositionality》中提出了负面抽样。虽然负面抽样是基于Skip-Gram 模型，它实际上是对一个不同的目标函数进行最优化。考虑一个“词-上下文”对（w,c），令P(D = 1|w, c)为(w, c)来自于语料库的概率。相应的，P(D = 0|w, c) 则是不来自于语料库的概率。我们首先对P(D = 1|w, c)用sigmoid函数建模：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-64-Frame">
         <span class="math" id="MathJax-Span-953">
          <span class="mrow" id="MathJax-Span-954">
           <span class="mi" id="MathJax-Span-955">
            p
           </span>
           <span class="mo" id="MathJax-Span-956">
            (
           </span>
           <span class="mi" id="MathJax-Span-957">
            D
           </span>
           <span class="mo" id="MathJax-Span-958">
            =
           </span>
           <span class="mn" id="MathJax-Span-959">
            1
           </span>
           <span class="texatom" id="MathJax-Span-960">
            <span class="mrow" id="MathJax-Span-961">
             <span class="mo" id="MathJax-Span-962">
              |
             </span>
            </span>
           </span>
           <span class="mi" id="MathJax-Span-963">
            w
           </span>
           <span class="mo" id="MathJax-Span-964">
            ,
           </span>
           <span class="mi" id="MathJax-Span-965">
            c
           </span>
           <span class="mo" id="MathJax-Span-966">
            ,
           </span>
           <span class="mi" id="MathJax-Span-967">
            θ
           </span>
           <span class="mo" id="MathJax-Span-968">
            )
           </span>
           <span class="mo" id="MathJax-Span-969">
            =
           </span>
           <span class="texatom" id="MathJax-Span-970">
            <span class="mrow" id="MathJax-Span-971">
             <span class="mfrac" id="MathJax-Span-972">
              <span class="mn" id="MathJax-Span-973">
               1
              </span>
              <span class="texatom" id="MathJax-Span-974">
               <span class="mrow" id="MathJax-Span-975">
                <span class="mn" id="MathJax-Span-976">
                 1
                </span>
                <span class="mo" id="MathJax-Span-977">
                 +
                </span>
                <span class="msubsup" id="MathJax-Span-978">
                 <span class="mi" id="MathJax-Span-979">
                  e
                 </span>
                 <span class="texatom" id="MathJax-Span-980">
                  <span class="mrow" id="MathJax-Span-981">
                   <span class="mo" id="MathJax-Span-982">
                    (
                   </span>
                   <span class="mo" id="MathJax-Span-983">
                    −
                   </span>
                   <span class="msubsup" id="MathJax-Span-984">
                    <span class="mi" id="MathJax-Span-985">
                     v
                    </span>
                    <span class="mi" id="MathJax-Span-986">
                     T
                    </span>
                    <span class="mi" id="MathJax-Span-987">
                     c
                    </span>
                   </span>
                   <span class="msubsup" id="MathJax-Span-988">
                    <span class="mi" id="MathJax-Span-989">
                     v
                    </span>
                    <span class="mi" id="MathJax-Span-990">
                     w
                    </span>
                   </span>
                   <span class="mo" id="MathJax-Span-991">
                    )
                   </span>
                  </span>
                 </span>
                </span>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        现在我们需要建立一个新的目标函数。如果(w, c)真是来自于语料库，目标函数能够最大化P(D = 1|w, c)。反之亦然。我们对这两个概率采用一个简单的最大似然法。（这里令θ为模型的参数，在我们的例子中，就是对应的U和V。）
       </p>
       <p>
       </p>
       <center>
        <br/>
        <img src="http://7xo0y8.com1.z0.glb.clouddn.com/cs224d_1_9.png?imageView/2/w/460/q/100"/>
       </center>
       注意这里的
       <span class="MathJax" id="MathJax-Element-65-Frame">
        <span class="math" id="MathJax-Span-992">
         <span class="mrow" id="MathJax-Span-993">
          <span class="texatom" id="MathJax-Span-994">
           <span class="mrow" id="MathJax-Span-995">
            <span class="munderover" id="MathJax-Span-996">
             <span class="mi" id="MathJax-Span-997">
              D
             </span>
             <span class="mo" id="MathJax-Span-998">
              ˜
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>
       </span>
       表示“错误的”或者“负面的”语料库，像句子”stock boil fish is toy”就是从这样的语料库来的。不自然的句子应该有比较低的发生概率，我们可以从词库中随机采样来产生这样的“负面的”语料库。我们的新目标函数就变成了：
       <p>
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-66-Frame">
         <span class="math" id="MathJax-Span-999">
          <span class="mrow" id="MathJax-Span-1000">
           <span class="mi" id="MathJax-Span-1001">
            l
           </span>
           <span class="mi" id="MathJax-Span-1002">
            o
           </span>
           <span class="mi" id="MathJax-Span-1003">
            g
           </span>
           <span class="mi" id="MathJax-Span-1004">
            σ
           </span>
           <span class="mo" id="MathJax-Span-1005">
            (
           </span>
           <span class="msubsup" id="MathJax-Span-1006">
            <span class="mi" id="MathJax-Span-1007">
             u
            </span>
            <span class="mo" id="MathJax-Span-1008">
             (
            </span>
           </span>
           <span class="mi" id="MathJax-Span-1009">
            c
           </span>
           <span class="mo" id="MathJax-Span-1010">
            −
           </span>
           <span class="mi" id="MathJax-Span-1011">
            m
           </span>
           <span class="mo" id="MathJax-Span-1012">
            +
           </span>
           <span class="mi" id="MathJax-Span-1013">
            j
           </span>
           <span class="msubsup" id="MathJax-Span-1014">
            <span class="mo" id="MathJax-Span-1015">
             )
            </span>
            <span class="mi" id="MathJax-Span-1016">
             T
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1017">
            .
           </span>
           <span class="msubsup" id="MathJax-Span-1018">
            <span class="mi" id="MathJax-Span-1019">
             v
            </span>
            <span class="mi" id="MathJax-Span-1020">
             c
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1021">
            )
           </span>
           <span class="mo" id="MathJax-Span-1022">
            +
           </span>
           <span class="munderover" id="MathJax-Span-1023">
            <span class="mo" id="MathJax-Span-1024">
             ∑
            </span>
            <span class="texatom" id="MathJax-Span-1025">
             <span class="mrow" id="MathJax-Span-1026">
              <span class="mi" id="MathJax-Span-1027">
               k
              </span>
              <span class="mo" id="MathJax-Span-1028">
               =
              </span>
              <span class="mn" id="MathJax-Span-1029">
               1
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-1030">
             K
            </span>
           </span>
           <span class="mi" id="MathJax-Span-1031">
            l
           </span>
           <span class="mi" id="MathJax-Span-1032">
            o
           </span>
           <span class="mi" id="MathJax-Span-1033">
            g
           </span>
           <span class="mi" id="MathJax-Span-1034">
            σ
           </span>
           <span class="mo" id="MathJax-Span-1035">
            (
           </span>
           <span class="mo" id="MathJax-Span-1036">
            −
           </span>
           <span class="msubsup" id="MathJax-Span-1037">
            <span class="texatom" id="MathJax-Span-1038">
             <span class="mrow" id="MathJax-Span-1039">
              <span class="munderover" id="MathJax-Span-1040">
               <span class="mi" id="MathJax-Span-1041">
                u
               </span>
               <span class="mo" id="MathJax-Span-1042">
                ˜
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-1043">
             T
            </span>
            <span class="mi" id="MathJax-Span-1044">
             k
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1045">
            .
           </span>
           <span class="msubsup" id="MathJax-Span-1046">
            <span class="mi" id="MathJax-Span-1047">
             v
            </span>
            <span class="mi" id="MathJax-Span-1048">
             c
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1049">
            )
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        在这里
        <span class="MathJax" id="MathJax-Element-67-Frame">
         <span class="math" id="MathJax-Span-1050">
          <span class="mrow" id="MathJax-Span-1051">
           <span class="mo" id="MathJax-Span-1052">
            {
           </span>
           <span class="msubsup" id="MathJax-Span-1053">
            <span class="texatom" id="MathJax-Span-1054">
             <span class="mrow" id="MathJax-Span-1055">
              <span class="munderover" id="MathJax-Span-1056">
               <span class="mi" id="MathJax-Span-1057">
                u
               </span>
               <span class="mo" id="MathJax-Span-1058">
                ˜
               </span>
              </span>
             </span>
            </span>
            <span class="mi" id="MathJax-Span-1059">
             k
            </span>
           </span>
           <span class="texatom" id="MathJax-Span-1060">
            <span class="mrow" id="MathJax-Span-1061">
             <span class="mo" id="MathJax-Span-1062">
              |
             </span>
            </span>
           </span>
           <span class="mi" id="MathJax-Span-1063">
            k
           </span>
           <span class="mo" id="MathJax-Span-1064">
            =
           </span>
           <span class="mn" id="MathJax-Span-1065">
            1
           </span>
           <span class="mo" id="MathJax-Span-1066">
            ,
           </span>
           <span class="mo" id="MathJax-Span-1067">
            ⋯
           </span>
           <span class="mo" id="MathJax-Span-1068">
            ,
           </span>
           <span class="mi" id="MathJax-Span-1069">
            K
           </span>
           <span class="mo" id="MathJax-Span-1070">
            }
           </span>
          </span>
         </span>
        </span>
        是从(Pn(w))中抽样取到的。需要多说一句的是，虽然关于怎么样最好地近似有许多讨论和研究，但是工作效果最好的似乎是指数为3/4的一元语言模型。至于为什么是3/4，下面有几个例子来帮助大家感性地理解一下：
       </p>
       <div class="MathJax_Display">
        <span class="MathJax" id="MathJax-Element-68-Frame">
         <span class="math" id="MathJax-Span-1071">
          <span class="mrow" id="MathJax-Span-1072">
           <span class="mi" id="MathJax-Span-1073">
            i
           </span>
           <span class="mi" id="MathJax-Span-1074">
            s
           </span>
           <span class="mo" id="MathJax-Span-1075">
            :
           </span>
           <span class="msubsup" id="MathJax-Span-1076">
            <span class="mn" id="MathJax-Span-1077">
             0.9
            </span>
            <span class="texatom" id="MathJax-Span-1078">
             <span class="mrow" id="MathJax-Span-1079">
              <span class="mn" id="MathJax-Span-1080">
               3
              </span>
              <span class="texatom" id="MathJax-Span-1081">
               <span class="mrow" id="MathJax-Span-1082">
                <span class="mo" id="MathJax-Span-1083">
                 /
                </span>
               </span>
              </span>
              <span class="mn" id="MathJax-Span-1084">
               4
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1085">
            =
           </span>
           <span class="mn" id="MathJax-Span-1086">
            0.92
           </span>
           <span class="mspace" id="MathJax-Span-1087">
           </span>
           <span class="mi" id="MathJax-Span-1088">
            c
           </span>
           <span class="mi" id="MathJax-Span-1089">
            o
           </span>
           <span class="mi" id="MathJax-Span-1090">
            n
           </span>
           <span class="mi" id="MathJax-Span-1091">
            s
           </span>
           <span class="mi" id="MathJax-Span-1092">
            t
           </span>
           <span class="mi" id="MathJax-Span-1093">
            i
           </span>
           <span class="mi" id="MathJax-Span-1094">
            t
           </span>
           <span class="mi" id="MathJax-Span-1095">
            u
           </span>
           <span class="mi" id="MathJax-Span-1096">
            t
           </span>
           <span class="mi" id="MathJax-Span-1097">
            i
           </span>
           <span class="mi" id="MathJax-Span-1098">
            o
           </span>
           <span class="mi" id="MathJax-Span-1099">
            n
           </span>
           <span class="mo" id="MathJax-Span-1100">
            :
           </span>
           <span class="msubsup" id="MathJax-Span-1101">
            <span class="mn" id="MathJax-Span-1102">
             0.09
            </span>
            <span class="texatom" id="MathJax-Span-1103">
             <span class="mrow" id="MathJax-Span-1104">
              <span class="mn" id="MathJax-Span-1105">
               3
              </span>
              <span class="texatom" id="MathJax-Span-1106">
               <span class="mrow" id="MathJax-Span-1107">
                <span class="mo" id="MathJax-Span-1108">
                 /
                </span>
               </span>
              </span>
              <span class="mn" id="MathJax-Span-1109">
               4
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1110">
            =
           </span>
           <span class="mn" id="MathJax-Span-1111">
            0.16
           </span>
           <span class="mspace" id="MathJax-Span-1112">
           </span>
           <span class="mi" id="MathJax-Span-1113">
            b
           </span>
           <span class="mi" id="MathJax-Span-1114">
            o
           </span>
           <span class="mi" id="MathJax-Span-1115">
            m
           </span>
           <span class="mi" id="MathJax-Span-1116">
            b
           </span>
           <span class="mi" id="MathJax-Span-1117">
            a
           </span>
           <span class="mi" id="MathJax-Span-1118">
            s
           </span>
           <span class="mi" id="MathJax-Span-1119">
            t
           </span>
           <span class="mi" id="MathJax-Span-1120">
            i
           </span>
           <span class="mi" id="MathJax-Span-1121">
            c
           </span>
           <span class="mo" id="MathJax-Span-1122">
            :
           </span>
           <span class="msubsup" id="MathJax-Span-1123">
            <span class="mn" id="MathJax-Span-1124">
             0.01
            </span>
            <span class="texatom" id="MathJax-Span-1125">
             <span class="mrow" id="MathJax-Span-1126">
              <span class="mn" id="MathJax-Span-1127">
               3
              </span>
              <span class="texatom" id="MathJax-Span-1128">
               <span class="mrow" id="MathJax-Span-1129">
                <span class="mo" id="MathJax-Span-1130">
                 /
                </span>
               </span>
              </span>
              <span class="mn" id="MathJax-Span-1131">
               4
              </span>
             </span>
            </span>
           </span>
           <span class="mo" id="MathJax-Span-1132">
            =
           </span>
           <span class="mn" id="MathJax-Span-1133">
            0.032
           </span>
          </span>
         </span>
        </span>
       </div>
       <p>
        你看，经过3/4这样一个指数处理，”Bombastic”(少见)被采样的概率是之前的3倍，而“is”这个词(多见)被采样的概率只是稍微增长了一点点。
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24681.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/wKiom1dnRBTyyFA3AADCqUt0n1g041.jpg-s_1362808532-300x119.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24681.html" rel="bookmark" title="Apache Spark不是唯一，快来了解三种新兴的开源数据分析工具">
         Apache Spark不是唯一，快来了解三种新兴的开源数据分析工具
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24667.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/u12835865061095899290fm21gp0-201x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24667.html" rel="bookmark" title="618前夕看京东IT基础设施建设与无人机物流规划">
         618前夕看京东IT基础设施建设与无人机物流规划
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24629.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/wKiom1dhAjqyZzsxAACjqD0ujYQ606.jpg-wh_651x-s_1268602189-300x196.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24629.html" rel="bookmark" title="下一代 Hadoop 技术演进路线展望">
         下一代 Hadoop 技术演进路线展望
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24625.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/u531183880522285712fm21gp0-286x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24625.html" rel="bookmark" title="支撑上万并发毫秒级事务响应！银行大型机负载下移至GemFire+HBase大数据平台的创新(一)">
         支撑上万并发毫秒级事务响应！银行大型机负载下移至GemFire+HBase大数据平台的创新(一)
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F24467.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/24467.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/24467.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>